package com.yz.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.text.SimpleDateFormat;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
// 评论实体类
public class Comment {
    private Integer id;
    private Integer blogId;
    private String blogName;
    private String commentator;
    private String email;
    private String commentBody;
    private String replyBody;
    private Date replyTime;
    private Date createTime;

    public Comment(Integer blogId, String blogName, String commentator, String email, String commentBody){
        this.blogId = blogId;
        this.blogName = blogName;
        this.commentator = commentator;
        this.email = email;
        this.commentBody = commentBody;
    }

    public String getCreateTime(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return simpleDateFormat.format(this.createTime);
    }

    public String getReplyTime(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return simpleDateFormat.format(this.replyTime);
    }
}
